<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title><?php echo C('WEB_TITLE');?></title>

		<link rel="stylesheet" type="text/css" href="/Public/css/common.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/js/layui/css/layui.css" media="all"/>

		<link rel="stylesheet" href="/Public/js/datepicker/datepicker.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/index.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/style.css"/>

		<link rel="stylesheet" href="<?php echo C('PC_ICON_HTTP');?>">

		<script type="text/javascript" >

			const moduleName = "<?php echo (MODULE_NAME); ?>";

		</script>

        <link rel="stylesheet" href="/Public/js/viewer/css/viewer.min.css">
		
		<link rel="stylesheet" type="text/css" href="/Public/js/select2/select2.css" media="all"/>

		<script type="text/javascript" src="/Public/js/jquery-1.9.1.min.js"></script>
		
		<script type="text/javascript" src="/Public/js/jquery-ui.min.js"></script>

		<script type="text/javascript" src="/Public/js/cookie/jquery.cookie.js"></script>

		<script type="text/javascript" src="/Public/js/lang/<?php echo (getStrToLower(cookie('think_language'))); ?>.js"></script>

		<script type="text/javascript" src="/Public/js/colorpicker.js"></script>

		<script type="text/javascript" src="/Public/js/layer/layer.js"></script>

		<script type="text/javascript" src="/Public/js/layui/layui.js"></script>

        <script type="text/javascript" src="/Public/js/feeldesk.js"></script>

        <script type="text/javascript" src="/Public/crm/js/index.js"></script>

        <script type="text/javascript" src="/Public/js/jquery.nicescroll.js"></script>

		<script type="text/javascript" src="/Public/js/clipboard.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/select2.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/jquery.core.js"></script>

	</head>

<body>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.all.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/moment.min.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.en.js"></script>

    <div class="fd-right-main">

        

    <div class="list-main layui-form">

		<div class="layui-tab">

            <ul class="layui-tab-title">

                <li class="layui-this"><?php echo L('OPPORTUNITY_LIST');?><span class="page-content"><?php echo L('TOTAL_RECORDS');?>：<span><?php echo ((isset($pageCount) && ($pageCount !== ""))?($pageCount):'0'); ?></span> <?php echo L('STRIP');?></span></li>

            </ul>

        </div>

		<!-- 筛选 -->
		<div class="list-filter select-fiter" data-type="customer_auth">

	<div class="list-filter-tit"><?php echo L('VIEW_RANGE');?></div>

	<?php if(!empty($isCreaterView)): if(!empty($isOwnViewAuth)): ?><div class="list-filter-option <?php if(($customer_auth) == "own-charge"): ?>active<?php endif; ?>" data-value="own-charge"><?php echo L('MY_CHARGE');?></div><?php endif; ?>

		<?php if(!empty($isOwnViewAuth)): ?><div class="list-filter-option <?php if(($customer_auth) == "own-create"): ?>active<?php endif; ?>" data-value="own-create"><?php echo L('MY_CREATED');?></div><?php endif; ?>

	<?php else: ?>

		<?php if(!empty($isOwnViewAuth)): ?><div class="list-filter-option <?php if(($customer_auth) == "own"): ?>active<?php endif; ?>" data-value="own"><?php echo L('PERSONAL');?></div><?php endif; endif; ?>

	<?php if(!empty($isGroupViewAuth)): ?><div class="list-filter-option <?php if(($customer_auth) == "group"): ?>active<?php endif; ?>" data-value="group"><?php echo L('GROUP');?></div><?php endif; ?>

	<?php if(!empty($isAllViewAuth)): ?><div class="list-filter-option <?php if(($customer_auth) == "all"): ?>active<?php endif; ?>" data-value="all"><?php echo L('WHOLE');?></div><?php endif; ?>

</div>

		<?php if(is_array($filterlist)): $i = 0; $__LIST__ = $filterlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["form_name"]) == "predict_time"): ?><!--<div class="list-filter select-fiter" data-type="predict_time">

					<div class="list-filter-tit"><?php echo ($vo["form_description"]); ?></div>
					<div class="list-filter-option" data-value=""><?php echo L('UNLIMITED');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "yesterday"): ?>active<?php endif; ?>" data-value="yesterday"><?php echo L('YESTERDAY');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "today"): ?>active<?php endif; ?>" data-value="today"><?php echo L('NOWADAYS');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "last-week"): ?>active<?php endif; ?>" data-value="last-week"><?php echo L('LAST_WEEK');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "this-week"): ?>active<?php endif; ?>" data-value="this-week"><?php echo L('THIS_WEEK');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "prev-month"): ?>active<?php endif; ?>" data-value="prev-month"><?php echo L('PREV_MONTH');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "this-month"): ?>active<?php endif; ?>" data-value="this-month"><?php echo L('THIS_MONTH');?></div>
					<div class="list-filter-option <?php if(($predict_time) == "this-season"): ?>active<?php endif; ?>" data-value="this-season"><?php echo L('THIS_SEASON');?></div>
					<div class="list-filter-option mr20 <?php if(($predict_time) == "this-year"): ?>active<?php endif; ?>" data-value="this-year"><?php echo L('THIS_YEAR');?></div>
					<div class="list-filter-time <?php if(!empty($predict_time)): if(!in_array(($predict_time), explode(',',"yesterday,today,last-week,this-week,prev-month,this-month,this-season,this-year"))): ?>active<?php endif; endif; ?>" id="customDate">
						<input type="text" class="w10 border-none white" <?php if(!empty($predict_time)): if(!in_array(($predict_time), explode(',',"yesterday,today,last-week,this-week,prev-month,this-month,this-season,this-year"))): ?>value="<?php echo ($predict_time); ?>"<?php endif; endif; ?> id="predictTime" />
						<?php echo L('CUSTOM_TIME');?>
					</div>

				</div>

				<script>

					layui.use('laydate',function()
					{
						var laydate = layui.laydate;

						var option = {
							elem:'#predictTime',
							eventElem: '#customDate',
							range: true,
							trigger: 'click',
							btns: ['clear', 'confirm'],
							done: function(value)
							{
								$("input[name='predict_time']").val(value);

								$('#filterForm').submit();
							}
						};

						laydate.render(option);
					})

				</script>-->

			<?php else: ?>

				<div class="list-filter select-fiter" data-type="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]">

					<div class="list-filter-tit"><?php echo ($vo["form_description"]); ?></div>

					<?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><div class="list-filter-checkbox <?php if(in_array($v,explode(',',$highKeyword['define_form'][$vo['form_name']]))): ?>active<?php endif; ?>" data-value="<?php echo ($v); ?>"><span class="iconfont <?php if(in_array($v,explode(',',$highKeyword['define_form'][$vo['form_name']]))): ?>icon-square-selected<?php else: ?>icon-weixuanzhong<?php endif; ?>"></span><?php echo ($v); ?></div><?php endforeach; endif; else: echo "" ;endif; ?>

				</div><?php endif; endforeach; endif; else: echo "" ;endif; ?>

		<div class="list-filter" data-type="highKeyword[time_range_type]">

			<div class="list-filter-tit"><?php echo L('SELECT_TIME');?></div>

			<div class="c-datepicker-date-editor  J-datepicker-range-day wit10 bra3">
	<input placeholder="<?php echo L('STARTING_TIME');?>" name="highKeyword[start_time]" class="begin c-datepicker-data-input only-date" value="<?php echo ($highKeyword["start_time"]); ?>"  readOnly="readOnly" />
	<span class="c-datepicker-range-separator">-</span>
	<input placeholder="<?php echo L('END_TIME');?>" name="highKeyword[end_time]"  class="end c-datepicker-data-input only-date" value="<?php echo ($highKeyword["end_time"]); ?>" readOnly="readOnly" />
</div>

<script type="text/javascript">

	$(function()
	{
		var DATAPICKERAPI = {
			// 默认input显示当前月,自己获取后填充
			activeMonthRange: function () {
				return {
					begin: moment().set({ 'date': 1, 'hour': 0, 'minute': 0, 'second': 0 }).format('YYYY-MM-DD HH:mm:ss'),
					end: moment().set({ 'hour': 23, 'minute': 59, 'second': 59 }).format('YYYY-MM-DD HH:mm:ss')
				}
			},
			shortcutMonth: function () {
				// 当月
				var nowDay = moment().get('date');
				var prevMonthFirstDay = moment().subtract(1, 'months').set({ 'date': 1 });
				var prevMonthDay = moment().diff(prevMonthFirstDay, 'days');
				return {
					now: '-' + nowDay + ',0',
					prev: '-' + prevMonthDay + ',-' + nowDay
				}
			},

			// 快捷选项option
			rangeShortcutOption1: [
				{
					name: "昨天",
					day: '-1,-1',
					time: '00:00:00,23:59:59'
				},
				{
					name: "今天",
					day: '0,0',
					time: '00:00:00,23:59:59'
				},
				{
					name: "最近三天",
					day: '-2,0',
					time: '00:00:00,23:59:59'
				},{
					name: "最近一周",
					day: '-6,0',
					time: '00:00:00,23:59:59'
				}, {
					name: "最近一个月",
					day: '-29,0',
					time: '00:00:00,23:59:59'
				}, {
					name:"最近三个月",
					day: '-89, 0',
					time: '00:00:00,23:59:59'
				}],
		};

		var lang = '<?php echo ($lang); ?>';

		var langTo = 'zh-CN';

		if(lang == 'en-us')
		{
			langTo = 'en';
		}

		if(langTo == 'en')
		{
			DATAPICKERAPI.rangeShortcutOption1 = [
				{
					name: "Yesterday",
					day: '-1,-1',
					time: '00:00:00,23:59:59'
				},
				{
					name: "Today",
					day: '0,0',
					time: '00:00:00,23:59:59'
				},
				{
					name: "Last 3 days",
					day: '-2,0',
					time: '00:00:00,23:59:59'
				},{
					name: "Last 7 days",
					day: '-6,0',
					time: '00:00:00,23:59:59'
				}, {
					name: "Last Month",
					day: '-29,0',
					time: '00:00:00,23:59:59'
				}, {
					name:"Last 3 months",
					day: '-89, 0',
					time: '00:00:00,23:59:59'
				}];
		}

		//年月日范围
		$('.J-datepicker-range-day').datePicker({
			hasShortcut: true,
			format: 'YYYY-MM-DD HH:mm:ss',
			isRange: true,
			language: langTo,
			shortcutOptions: DATAPICKERAPI.rangeShortcutOption1,
			endDate: moment(new Date()), //设置结束器日期
			maxDate: moment(new Date()), //设置最大日期
			hide:function () {
				var starttime = "<?php echo ($highKeyword["start_time"]); ?>";
				var endtime = "<?php echo ($highKeyword["end_time"]); ?>";

				var new_starttime = $("input[name='highKeyword[start_time]']").val();
				var new_endtime = $("input[name='highKeyword[end_time]']").val();

				if(new_starttime != starttime || new_endtime != endtime)
				{
					$("input[name='highKeyword[start_time]']").val(new_starttime);
					$("input[name='highKeyword[end_time]']").val(new_endtime);

					$("input[name='highKeyword[start_time]']").parents('form').submit();
				}
			}
		});
	});

</script>

			<div data-value="create_time" class="filter-time-type layui-form-radio mt0 <?php if(($highKeyword[time_range_type]) == "create_time"): ?>layui-form-radioed<?php endif; if(empty($highKeyword[time_range_type])): ?>layui-form-radioed<?php endif; ?> ml15 fts13 gray6">
				<i class="iconfont <?php if(($highKeyword[time_range_type]) == "create_time"): ?>icon-xuanzhong<?php else: if(empty($highKeyword[time_range_type])): ?>icon-xuanzhong<?php else: ?>icon-xuanze<?php endif; endif; ?> fts15"></i>
				<div><?php echo L('CREATE_TIME');?></div>
			</div>

			<div data-value="next_contact_time" class="filter-time-type <?php if(($highKeyword[time_range_type]) == "next_contact_time"): ?>layui-form-radioed<?php endif; ?> layui-form-radio mt0 fts13 gray6">
				<i class="iconfont <?php if(($highKeyword[time_range_type]) == "next_contact_time"): ?>icon-xuanzhong<?php else: ?>icon-xuanze<?php endif; ?> fts15"></i>
				<div><?php echo L('NEXT_CONTACT');?></div>
			</div>

			<div data-value="last_follow_time" class="filter-time-type <?php if(($highKeyword[time_range_type]) == "last_follow_time"): ?>layui-form-radioed<?php endif; ?> layui-form-radio mt0 fts13 gray6">
				<i class="iconfont <?php if(($highKeyword[time_range_type]) == "last_follow_time"): ?>icon-xuanzhong<?php else: ?>icon-xuanze<?php endif; ?> fts15"></i>
				<div><?php echo L('FINAL_FOLLOW-UP');?></div>
			</div>

			<?php if(is_array($filterlist)): $i = 0; $__LIST__ = $filterlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["form_type"]) == "date"): ?><div data-value="<?php echo ($vo["form_name"]); ?>" class="filter-time-type <?php if(($highKeyword[time_range_type]) == $vo["form_name"]): ?>layui-form-radioed<?php endif; ?> layui-form-radio mt0 fts13 gray6">
						<i class="iconfont <?php if(($highKeyword[time_range_type]) == $vo["form_name"]): ?>icon-xuanzhong<?php else: ?>icon-xuanze<?php endif; ?> fts15"></i>
						<div><?php echo ($vo["form_description"]); ?></div>
					</div><?php endif; endforeach; endif; else: echo "" ;endif; ?>

		</div>

		<div class="list-filter select-fiter" data-type="sort_by">

	<div class="list-filter-tit"><?php echo L('SORT_BY');?></div>

	<div class="list-filter-option list-filter-sort-by <?php if(in_array(($sort_by), explode(',',"followtime-desc,followtime-asc"))): ?>active<?php endif; ?>" data-value="followtime-desc">
		<?php echo L('SORT_BY_LAST_FOLLOW_UP_TIME');?>
		<?php if(in_array(($sort_by), explode(',',"followtime-desc,followtime-asc"))): if(($sort_by) == "followtime-asc"): ?><i class="iconfont icon-up" data-value="followtime-desc"></i><?php endif; ?>
			<?php if(($sort_by) == "followtime-desc"): ?><i class="iconfont icon-downs" data-value="followtime-asc"></i><?php endif; ?>

			<?php else: ?>
			<i class="iconfont icon-sort-small-copy" data-value="followtime-desc"></i><?php endif; ?>
	</div>

	<div class="list-filter-option list-filter-sort-by <?php if(in_array(($sort_by), explode(',',"contacttime-desc,contacttime-asc"))): ?>active<?php endif; ?>" data-value="contacttime-desc">
		<?php echo L('SORT_BY_NEXT_CONTACT_TIME');?>
		<?php if(in_array(($sort_by), explode(',',"contacttime-desc,contacttime-asc"))): if(($sort_by) == "contacttime-asc"): ?><i class="iconfont icon-up" data-value="contacttime-desc"></i><?php endif; ?>
			<?php if(($sort_by) == "contacttime-desc"): ?><i class="iconfont icon-downs" data-value="contacttime-asc"></i><?php endif; ?>

			<?php else: ?>
			<i class="iconfont icon-sort-small-copy" data-value="contacttime-desc"></i><?php endif; ?>
	</div>

	<div class="list-filter-option list-filter-sort-by <?php if(in_array(($sort_by), explode(',',"createtime-desc,createtime-asc"))): ?>active<?php endif; ?>" data-value="createtime-desc">
		<?php echo L('SORT_BY_CREATION_TIME');?>
		<?php if(in_array(($sort_by), explode(',',"createtime-desc,createtime-asc"))): if(($sort_by) == "createtime-asc"): ?><i class="iconfont icon-up" data-value="createtime-desc"></i><?php endif; ?>
			<?php if(($sort_by) == "createtime-desc"): ?><i class="iconfont icon-downs" data-value="createtime-asc"></i><?php endif; ?>

			<?php else: ?>
			<i class="iconfont icon-sort-small-copy" data-value="createtime-desc"></i><?php endif; ?>

	</div>

</div>

        <div class="list-header clearfix">

            <div class="header-left">

                <?php echo FEELCRM('Opportunity/create','',L('ADD_OPPORTUNITY'),'item-deleteBtn','','iconfont icon-xinzeng');?>

            </div>

            <div class="header-right">

				<div class="customer-listOperate">

					<div class="listOperate">

						<div class="layui-form">

							<select class="layui-input" disabled><option><?php echo L('OPERATION');?></option></select>

						</div>

						<div class="operate hidden">

							<!--<?php if(!empty($istransferOpportunityAuth)): ?><a href="javascript:" class="chooseMemberDetail" data-id="" data-href="<?php echo U('Opportunity/transfer');?>" data-name="<?php echo L('TRANSFER');?>" ><?php echo L('OPPORTUNITY_TRANSFER');?></a><?php endif; ?>-->

							<?php if(!empty($isDelOpportunityAuth)): ?><a href="javascript:" data-href="<?php echo U('Opportunity/delete');?>" data-name="<?php echo L('DELETE');?>" id="CrmListDelete"><?php echo L('DELETE_OPPORTUNITY');?></a><?php endif; ?>

							<?php if(!empty($isExportOpportunityAuth)): ?><a href="javascript:" title="<?php echo L('EXPORT');?>" id="startExport"><?php echo L('EXPORT_DATA');?></a><?php endif; ?>

							<?php if(!empty($isImportOpportunityAuth)): ?><a href="javascript:" id="uploadFile"><?php echo L('IMPORT_CUSTOMER');?></a>

								<a href="/<?php echo ($importTemp); ?>" title="<?php echo L('OPPORTUNITY_IMPORT_TEMPLATE');?>" download="<?php echo L('OPPORTUNITY_IMPORT_TEMPLATE');?>"><?php echo L('DOWNLOAD_TEMPLATE');?></a><?php endif; ?>

						</div>

					</div>

				</div>

				<span class="advanced-searc-btn fr" id="advanced-search-btn"><i class="iconfont icon-shaixuan"></i> <span><?php echo L('ADVANCED_SEARCH');?></span></span>

                <form action="<?php echo ($controllerAndAction); ?>" method="get" class="fr" id="filterForm">

					<input type="hidden" name='customer_auth' value="<?php echo ($customer_auth); ?>" />

					<input type="hidden" name='sort_by' value="<?php echo ($sort_by); ?>" />

					<input type="hidden" name='predict_time' value="<?php echo ($predict_time); ?>" />

					<input type="hidden" name='highKeyword[condition]' value="1" />

					<input type="hidden" name='highKeyword[define_form][stage]' value="<?php echo ($highKeyword["define_form"]["stage"]); ?>" />

					<input type="hidden" name="highKeyword[start_time]"  value="<?php echo ($highKeyword["start_time"]); ?>" />

					<input type="hidden" name="highKeyword[end_time]"  value="<?php echo ($highKeyword["end_time"]); ?>" />

					<input type="hidden" name="highKeyword[time_range_type]" value="<?php echo ($highKeyword["time_range_type"]); ?>" />

					<!--<div class="c-datepicker-date-editor  J-datepicker-range-day wit10 bra3">
	<input placeholder="<?php echo L('STARTING_TIME');?>" name="highKeyword[start_time]" class="begin c-datepicker-data-input only-date" value="<?php echo ($highKeyword["start_time"]); ?>"  readOnly="readOnly" />
	<span class="c-datepicker-range-separator">-</span>
	<input placeholder="<?php echo L('END_TIME');?>" name="highKeyword[end_time]"  class="end c-datepicker-data-input only-date" value="<?php echo ($highKeyword["end_time"]); ?>" readOnly="readOnly" />
</div>

<script type="text/javascript">

	$(function()
	{
		var DATAPICKERAPI = {
			// 默认input显示当前月,自己获取后填充
			activeMonthRange: function () {
				return {
					begin: moment().set({ 'date': 1, 'hour': 0, 'minute': 0, 'second': 0 }).format('YYYY-MM-DD HH:mm:ss'),
					end: moment().set({ 'hour': 23, 'minute': 59, 'second': 59 }).format('YYYY-MM-DD HH:mm:ss')
				}
			},
			shortcutMonth: function () {
				// 当月
				var nowDay = moment().get('date');
				var prevMonthFirstDay = moment().subtract(1, 'months').set({ 'date': 1 });
				var prevMonthDay = moment().diff(prevMonthFirstDay, 'days');
				return {
					now: '-' + nowDay + ',0',
					prev: '-' + prevMonthDay + ',-' + nowDay
				}
			},

			// 快捷选项option
			rangeShortcutOption1: [
				{
					name: "昨天",
					day: '-1,-1',
					time: '00:00:00,23:59:59'
				},
				{
					name: "今天",
					day: '0,0',
					time: '00:00:00,23:59:59'
				},
				{
					name: "最近三天",
					day: '-2,0',
					time: '00:00:00,23:59:59'
				},{
					name: "最近一周",
					day: '-6,0',
					time: '00:00:00,23:59:59'
				}, {
					name: "最近一个月",
					day: '-29,0',
					time: '00:00:00,23:59:59'
				}, {
					name:"最近三个月",
					day: '-89, 0',
					time: '00:00:00,23:59:59'
				}],
		};

		var lang = '<?php echo ($lang); ?>';

		var langTo = 'zh-CN';

		if(lang == 'en-us')
		{
			langTo = 'en';
		}

		if(langTo == 'en')
		{
			DATAPICKERAPI.rangeShortcutOption1 = [
				{
					name: "Yesterday",
					day: '-1,-1',
					time: '00:00:00,23:59:59'
				},
				{
					name: "Today",
					day: '0,0',
					time: '00:00:00,23:59:59'
				},
				{
					name: "Last 3 days",
					day: '-2,0',
					time: '00:00:00,23:59:59'
				},{
					name: "Last 7 days",
					day: '-6,0',
					time: '00:00:00,23:59:59'
				}, {
					name: "Last Month",
					day: '-29,0',
					time: '00:00:00,23:59:59'
				}, {
					name:"Last 3 months",
					day: '-89, 0',
					time: '00:00:00,23:59:59'
				}];
		}

		//年月日范围
		$('.J-datepicker-range-day').datePicker({
			hasShortcut: true,
			format: 'YYYY-MM-DD HH:mm:ss',
			isRange: true,
			language: langTo,
			shortcutOptions: DATAPICKERAPI.rangeShortcutOption1,
			endDate: moment(new Date()), //设置结束器日期
			maxDate: moment(new Date()), //设置最大日期
			hide:function () {
				var starttime = "<?php echo ($highKeyword["start_time"]); ?>";
				var endtime = "<?php echo ($highKeyword["end_time"]); ?>";

				var new_starttime = $("input[name='highKeyword[start_time]']").val();
				var new_endtime = $("input[name='highKeyword[end_time]']").val();

				if(new_starttime != starttime || new_endtime != endtime)
				{
					$("input[name='highKeyword[start_time]']").val(new_starttime);
					$("input[name='highKeyword[end_time]']").val(new_endtime);

					$("input[name='highKeyword[start_time]']").parents('form').submit();
				}
			}
		});
	});

</script>-->

					<div class="compact-menu">

						<!--<?php if(!empty($isExportOpportunityAuth)): ?><a href="javascript:" title="<?php echo L('EXPORT');?>" id="startExport"><i class="iconfont icon-export"></i></a><?php endif; ?>

						<a href="javascript:" title="<?php echo L('ADVANCED_SEARCH');?>" id="advanced-search-btn"><i class="iconfont icon-shaixuan"></i></a>-->

					</div>

                    <div class="compact-search">

                        <i class="iconfont icon-search crmSearchBtn"></i>

                        <input type="text" name="keyword" value="<?php echo ($keyword); ?>" placeholder="<?php echo L('OPPORTUNITY_NO');?>(<?php echo L('WITHOUT_PREFIX');?>)/<?php echo L('OPPORTUNITY_NAME');?>" onkeydown="javascript:if (event.keyCode == 13){$(this).parents('form').submit();}" />

                        <!--<a href="javascript:" class="searchBtn"><?php echo L('SEARCH');?></a>-->

                    </div>

                </form>

            </div>

        </div>

		<div id="advanced-search" class="hidden feelcrm-advanced-search feeldesk-form hg100">

			<form action="<?php echo ($controllerAndAction); ?>" method="get" id="highSearchForm" class="hg100">

				<input type="hidden" name='customer_auth' value="<?php echo ($customer_auth); ?>" />

				<input type="hidden" name='sort_by' value="<?php echo ($sort_by); ?>" />

				<input type="hidden" name='predict_time' value="<?php echo ($predict_time); ?>" />

			<div class="feeldesk-form pd0 feelcrm-form">

				<div class="layui-tab">

					<ul class="layui-tab-title">

						<li class="tab-title-name"><?php echo L('ADVANCED_SEARCH');?></li>

						<li class="tab-title-btn">

							<a href="javascript:highSearch();" class="layui-btn layui-btn-normal titleSubmit"><?php echo l('SEARCH');?></a>

							<a href="javascript:closeLayerAll();" class="layui-btn layui-btn-normal titleCancel"><?php echo l('CANCEL');?></a>

							<div class="clear"></div>

						</li>

					</ul>

				</div>

			</div>


			<div class="form-content">

                <div class="form-item pb25 pt50 create-both-end">

					<input type="hidden" name="highKeyword[start_time]" value="<?php echo ($highKeyword["start_time"]); ?>" >

					<input type="hidden" name="highKeyword[end_time]" value="<?php echo ($highKeyword["end_time"]); ?>" >

					<input type="hidden" name="highKeyword[time_range_type]" value="<?php echo ($highKeyword["time_range_type"]); ?>" >

					<div class="layui-form-item">

						<label class="layui-form-label">

							<?php echo L('MEET_CONDITIONS');?>

						</label>

						<div class="layui-input-inline">

							<input type="radio" name="highKeyword[condition]" value="1" <?php if(($highKeyword["condition"]) == "1"): ?>checked<?php endif; ?> <?php if(empty($highKeyword["condition"])): ?>checked<?php endif; ?> title="<?php echo L('ALL_SATISFIED');?>">

							<input type="radio" name="highKeyword[condition]" value="2" <?php if(($highKeyword["condition"]) == "2"): ?>checked<?php endif; ?> title="<?php echo L('PARTIALLY_SATISFIED');?>">

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('HIGH_FILTER_REMARK');?>"></i>

					</div>

					<?php if(ACTION_NAME != 'product' && CONTROLLER_NAME != 'Product'): if(($customer_auth) != "own"): ?><div class="layui-form-item">

								<label class="layui-form-label mt5"><?php echo L('SELECT_SECTOR');?></label>

								<div class="layui-input-inline" id="highKeywordGroupId"></div>

							</div><?php endif; ?>

					<div class="layui-form-item">

						<?php if(in_array(CONTROLLER_NAME.'/'.ACTION_NAME,['Clue/pool','Customer/pool','Customer/followup','Recover/follow'])): ?><label class="layui-form-label mt5"><?php echo L('FOUNDER');?></label>

						<?php else: ?>

							<label class="layui-form-label mt5"><?php echo L('LEADER');?></label><?php endif; ?>

						<div class="layui-input-inline" id="highKeywordMemberId"></div>

					</div>

					<?php if(!in_array(CONTROLLER_NAME.'/'.ACTION_NAME,['Clue/pool','Customer/pool','Customer/followup','Recover/follow']) && $isCreaterView): ?><div class="layui-form-item">

							<label class="layui-form-label mt5"><?php echo L('FOUNDER');?></label>

							<div class="layui-input-inline" id="highKeywordCreateId"></div>

						</div><?php endif; ?>

					<script type="text/javascript">

						var highKeywordGroups = <?php echo ($highKeywordGroups); ?>;

						var highKeywordMembers = <?php echo ($highKeywordMembers); ?>;

						var highKeywordCurrMembers = '<?php echo ($highKeywordCurrMembers); ?>';

						if(!highKeywordCurrMembers)
						{
							highKeywordCurrMembers = highKeywordMembers;
						}
						else
						{
							highKeywordCurrMembers = JSON.parse(highKeywordCurrMembers);
						}

						var highKeywordGroupId = '<?php echo ($highKeywordGroupId); ?>';

						var highKeywordMemberId = '<?php echo ($highKeywordMemberId); ?>';

						var highKeywordCreateId = '<?php echo ($highKeywordCreateId); ?>';

						var is_loaded = 1;

						layui.config({
							base : '/Public/js/layui/extends/'
						}).use(['selectM'],function()
						{
							var list = layui.selectM(
							{
								elem: '#highKeywordMemberId',
								tips: '<?php echo L("PLEASE_SELECT");?>',
								data: highKeywordCurrMembers,
								selected: highKeywordMemberId.split(','),
								width:'60%',
								max:100,
							});

							if($("#highKeywordCreateId").size()>0)
							{
								var list2 = layui.selectM(
								{
									elem: '#highKeywordCreateId',
									tips: '<?php echo L("PLEASE_SELECT");?>',
									data: highKeywordCurrMembers,
									selected: highKeywordCreateId.split(','),
									width:'60%',
									max:100,
								});
							}

							layui.selectM(
							{
								elem: '#highKeywordGroupId',
								data: highKeywordGroups,
								selected: highKeywordGroupId.split(','),
								tips: '<?php echo L("PLEASE_SELECT");?>',
								width:'60%',
								max:100,
								callback:function (values)
								{
									var groups = values;

									if(groups && is_loaded != 1)
									{
										if(groups.length == 0)
										{
											list.config.data = highKeywordMembers;
											list.render();
											list.render();

											if($("#highKeywordCreateId").size()>0)
											{
												list2.config.data = highKeywordMembers;
												list2.render();
												list2.render();
											}
										}
										else
										{
											$.ajax({
												url:"<?php echo U('AjaxRequest/getMemberByGroups');?>",
												type:'POST',
												async: false,
												data:{'groups':groups},
												datatype:'json',
												success:function(data)
												{
													if(data)
													{
														list.config.data = data.data;
														list.render();
														list.render();

														if($("#highKeywordCreateId").size()>0)
														{
															list2.config.data = data.data;
															list2.render();
															list2.render();
														}
													}
												}
											});
										}
									}
									is_loaded = 0;
								}
							});
						})

					</script><?php endif; ?>

					<div class="layui-form-item">

						<label class="layui-form-label">

						   <?php echo L('OWNED_CUSTOMER');?>

						</label>

						<div class="layui-input-inline">

							<?php if(empty($highKeyword["customer_id"])): ?><input type="radio" id="selectCustomerInput" class="layui-input" name="highKeyword[customer_id]" title="<?php echo L('NO_CUSTOMER_SELECTED');?>" checked value="" readonly />

							<?php else: ?>

								<input type="radio" id="selectCustomerInput" class="layui-input" name="highKeyword[customer_id]" title="<?php echo CrmgetFieldName($highKeyword['customer_id'],'customer');?>" checked value="<?php echo ($highKeyword["customer_id"]); ?>" readonly /><?php endif; ?>

							<div id="selectCustomer" class="feelcrm-commbtn" ><?php echo L('SELECT_CUSTOMER');?></div>

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('ENTER_NAME_SEARCH');?>"></i>

					</div>

					<!--<div class="layui-form-item">

						<label class="layui-form-label">

						   <?php echo L('LEADER');?>

						</label>

						<div class="layui-input-inline">

							<select name="highKeyword[member_id]" lay-ignore id="select2" >

								<option value=""><?php echo L('SELECT_LEADER');?></option>

								<?php if(is_array($members)): $i = 0; $__LIST__ = $members;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v["member_id"]); ?>" <?php if(($highKeyword["member_id"]) == $v["member_id"]): ?>selected<?php endif; ?>><?php echo ($v["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>

							</select>

							<script type="text/javascript">

								$("#select2").select2();

							</script>

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('ENTER_NAME_SEARCH');?>"></i>

					</div>-->


					<div class="layui-form-item">

						<label class="layui-form-label">

						   <?php echo L('OPPORTUNITY_NO');?>

						</label>

						<div class="layui-input-inline">

							 <input type="text" name="highKeyword[opportunity_no]" value="<?php echo ($highKeyword["opportunity_no"]); ?>" placeholder="<?php echo L('NOT_OPPORTUNITY_PREFIX');?>" class="layui-input">

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('SEARCH_FUZZY_QUERY1');?>"></i>

					</div>

					<?php $t = 0; $ft = 0; $reg = 0; ?>

<?php if(is_array($defineformlist)): $i = 0; $__LIST__ = $defineformlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="layui-form-item">

		<label class="layui-form-label">

		   <?php echo ($vo["form_description"]); ?>

		</label>

		<?php if(($vo["form_type"]) == "region"): $reg++; ?>

			<div class="region-input-div fl wd60">

			<div class="layui-input-inline wd100 mb10 layui-form region-item" lay-filter="country">

				<select class="regionCountry" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>][defaultCountry]" lay-filter="select-country<?php echo $reg; ?>" id="country<?php echo $reg; ?>" lay-ignore >

					<option value=""><?php echo L('PLEASE_SELECT');?></option>

					<?php if(is_array($country)): $i = 0; $__LIST__ = $country;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vc): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vc["code"]); ?>"><?php echo ($vc["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>

				</select>

			</div>

			<div class="layui-input-inline wd100 mb10 hidden layui-form region-item" lay-filter="province">

				<select class="regionProv" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>][defaultProv]" lay-filter="select-province<?php echo $reg; ?>" id="province<?php echo $reg; ?>" lay-ignore>

					<option value=""><?php echo L('PLEASE_SELECT');?></option>

				</select>

			</div>

			<div class="layui-input-inline wd100 mb10 hidden layui-form region-item" lay-filter="city">

				<select class="regionCity" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>][defaultCity]" lay-filter="select-city<?php echo $reg; ?>" id="city<?php echo $reg; ?>" lay-ignore>

					<option value=""><?php echo L('PLEASE_SELECT');?></option>

				</select>

			</div>

			<div class="layui-input-inline wd100 mb10 hidden layui-form region-item" lay-filter="area">

				<select name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>][defaultArea]" lay-filter="select-area<?php echo $reg; ?>" id="area<?php echo $reg; ?>" lay-ignore >

					<option value=""><?php echo L('PLEASE_SELECT');?></option>

				</select>

			</div>

			</div>

			<i class="layui-icon layui-icon-about intro-icon fl blue8 ml10" data-note="<?php echo L('ENTER_NAME_SEARCH');?>"></i>

			<script type="text/javascript">

				$("#country<?php echo $reg; ?>").select2();

				$("#province<?php echo $reg; ?>").select2();

				$("#city<?php echo $reg; ?>").select2();

				$("#area<?php echo $reg; ?>").select2();

				$("#country<?php echo $reg; ?>").change(function()
				{
					selectProvince('<?php echo $reg; ?>',"<?php echo U('AjaxRequest/getRegion');?>");
				})

				$("#province<?php echo $reg; ?>").change(function()
				{
					selectCity('<?php echo $reg; ?>',"<?php echo U('AjaxRequest/getRegion');?>");
				})

				$("#city<?php echo $reg; ?>").change(function()
				{
					selectArea('<?php echo $reg; ?>',"<?php echo U('AjaxRequest/getRegion');?>");
				})

			</script>

		<?php else: ?>

			<div class="layui-input-inline">

				 <?php if(($vo["form_type"]) == "text"): ?><!-- 单行文本框 -->
					<input type="text" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

				 <?php if(($vo["form_type"]) == "phone"): ?><!-- <?php echo L('CELL_PHONE');?> -->
					<input type="text" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

				 <?php if(($vo["form_type"]) == "email"): ?><!-- <?php echo L('MAILBOX');?> -->
					<input type="text" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

				 <?php if(($vo["form_type"]) == "number"): ?><!-- <?php echo L('DIGITAL');?> -->
					<input type="number" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

				<?php if(($vo["form_type"]) == "decimal"): ?><!-- 小数 -->
					<input type="text" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

				<?php if(($vo["form_type"]) == "select"): ?><!-- 下拉菜单 -->
					<select name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]">

						<option value=""><?php echo ($vo["form_description"]); ?></option>

						<?php if(is_array($vo["option"])): foreach($vo["option"] as $key=>$op): ?><option value="<?php echo ($op); ?>" <?php if(($highKeyword['define_form'][$vo['form_name']]) == $op): ?>selected<?php endif; ?>><?php echo ($op); ?></option><?php endforeach; endif; ?>

					</select><?php endif; ?>
				
				<?php if(($vo["form_type"]) == "select_text"): $st++; ?>
					<!-- 下拉填写 -->
					<input type="text" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" placeholder="" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" readonly="readonly" class="layui-input cursor">

					<ul id="selectText<?php echo ($st); ?>" class="select-text">

						<?php if(is_array($vo["option"])): foreach($vo["option"] as $key=>$op): ?><li data-value="<?php echo ($op); ?>" <?php if(($highKeyword['define_form'][$vo['form_name']]) == $op): ?>class="active"<?php endif; ?>><?php echo ($op); ?></li><?php endforeach; endif; ?>

					</ul>

					<script>

						$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').click(function ()
						{
							if($('#selectText<?php echo ($st); ?>').is(':hidden'))
							{
								$('#selectText<?php echo ($st); ?>').slideDown(100);
							}
							else
							{
								$('#selectText<?php echo ($st); ?>').slideUp(100);
							}

							$('#selectText<?php echo ($st); ?> li').click(function ()
							{
								$('#selectText<?php echo ($st); ?> li').removeClass('active');
								var value = $(this).data('value');
								if(value == '其他')
								{
									$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').removeAttr("readonly");
									$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').val('');
									$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').focus();
								}
								else
								{
									$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').attr('readonly','readonly');
									$('input[name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]').val(value);
								}
								$(this).addClass('active');
								$('#selectText<?php echo ($st); ?>').hide();
							})
						})

					</script><?php endif; ?>

				<!-- 时间控件 -->
				<?php if(($vo["form_type"]) == "date"): $ft++; ?>

					<input type='text' name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" class="layui-input cursor layui-form-time" id="form_time<?php echo $ft; ?>" placeholder="<?php echo L('SELECT_TIME');?>" ><?php endif; ?>

				<?php if(($vo["form_type"]) == "checkbox"): ?><!-- 复选框 -->
					<?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="checkbox" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>][]" <?php if(in_array(($op), is_array($highKeyword['define_form'][$vo['form_name']])?$highKeyword['define_form'][$vo['form_name']]:explode(',',$highKeyword['define_form'][$vo['form_name']]))): ?>checked<?php endif; ?> lay-skin="primary" title="<?php echo ($op); ?>" value="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

				<?php if(($vo["form_type"]) == "radio"): ?><!-- 单选框-->
					<?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="radio" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" <?php if(($highKeyword['define_form'][$vo['form_name']]) == $op): ?>checked<?php endif; ?> value="<?php echo ($op); ?>" title="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

				<!-- <input type="text" name="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($highKeyword['define_form'][$vo['form_name']]); ?>" placeholder="" class="layui-input">-->

			</div>

			<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('ENTER_OR_SELECT_QUERY');?>"></i><?php endif; ?>

	</div><?php endforeach; endif; else: echo "" ;endif; ?>


				</div>

			</div>

			</form>

		</div>

        <div id='list' class="item-list feelcrm-list">

            <table class="layui-table" lay-skin="line">

                <thead>

                    <tr>

						<th class="checkbox"><input type="checkbox" name="" lay-skin="primary" lay-filter="ListAllChoose"></th>

                        <!--<th><?php echo L('OPPORTUNITY_NO');?></th>-->

						<?php if(is_array($formList)): $i = 0; $__LIST__ = $formList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
							<?php if(!$vo['role_id'] || in_array($index['role_id'],explode(',',$vo['role_id']))): ?><th><?php echo ($vo["form_description"]); ?></th>

							<?php if(($vo["form_name"]) == "name"): ?><th><?php echo L('OWNED_CUSTOMER');?></th><?php endif; endif; endforeach; endif; else: echo "" ;endif; ?>

						<th><?php echo L('FINAL_FOLLOW-UP');?></th>

						<th><?php echo L('NEXT_CONTACT');?></th>

						<th><?php echo L('CREATE_TIME');?></th>

						<th><?php echo L('LEADER');?></th>

						<th><?php echo L('FOUNDER');?></th>

						<th><?php echo L('ENTRY_METHOD');?></th>

                    </tr>

                </thead>

                <tbody>

                    <?php if(empty($opportunity)): ?><tr class="nodata center">

                            <td colspan="11">

                                <p><i class="iconfont icon-nothing fts20"></i></p>

                                <p><?php echo L('NO_DATA');?></p>

                            </td>

                        </tr>

                    <?php else: ?>

                        <?php if(is_array($opportunity)): $i = 0; $__LIST__ = $opportunity;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr data-id="<?php echo (encrypt($vo["opportunity_id"],'OPPORTUNITY')); ?>" data-customer="<?php echo (encrypt($vo["customer_id"],'CUSTOMER')); ?>" data-no="<?php echo ($vo["opportunity_prefix"]); echo ($vo["opportunity_no"]); ?>">

								<td class="checkbox relative">

									<input type="checkbox" name="del[]" lay-skin="primary" value="<?php echo (encrypt($vo["opportunity_id"],'OPPORTUNITY')); ?>" >

								</td>

                                <!--<td onclick="clickOpenDetail(this,'opportunity')" class="blue8"><?php echo ($vo["opportunity_prefix"]); echo ($vo["opportunity_no"]); ?></td>-->

								<?php if(is_array($formList)): $i = 0; $__LIST__ = $formList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
									<?php if(!$v['role_id'] || in_array($index['role_id'],explode(',',$v['role_id']))): ?><td onclick="clickOpenDetail(this,'opportunity')" <?php if(($v["form_type"]) == "textarea"): ?>title="<?php echo (strip_tags($vo['detail'][$v['form_name']])); ?>"<?php endif; ?> <?php if(($v["form_name"]) == "name"): ?>class="blue8"<?php endif; ?> <?php if(($v["form_name"]) == "price"): ?>class="red"<?php endif; ?>><?php if(($v["form_type"]) == "textarea"): echo mb_substr(strip_tags($vo['detail'][$v['form_name']]),0,20);?>...<?php else: echo ($vo['detail'][$v['form_name']]); endif; ?></td>

									<?php if(($v["form_name"]) == "name"): ?><td mini='elseCustomer' class="blue8"><?php echo ($vo["customer_name"]); ?></td><?php endif; endif; endforeach; endif; else: echo "" ;endif; ?>

								<td onclick="clickOpenDetail(this,'opportunity')"><?php echo (getDates($vo["lastfollowtime"])); ?></td>

								<td onclick="clickOpenDetail(this,'opportunity')"><?php echo (getDates($vo["nextcontacttime"])); ?></td>

								<td onclick="clickOpenDetail(this,'opportunity')"><?php echo (getDates($vo["createtime"])); ?></td>

                                <td onclick="clickOpenDetail(this,'opportunity')"><?php echo ($vo["member_name"]); ?></td>

                                <td onclick="clickOpenDetail(this,'opportunity')"><?php echo ($vo["create_name"]); ?></td>

								<td onclick="clickOpenDetail(this,'opportunity')"><?php echo getCrmEntryMethod($vo['entry_method']);?></td>

                            </tr><?php endforeach; endif; else: echo "" ;endif; endif; ?>

                </tbody>

            </table>

            <div class="right-list-page clearfix"><div class="feeldesk-page"><?php echo ($page); ?></div></div>

        </div>

        

    </div>

	<?php if(!empty($istransferOpportunityAuth)): ?><div class="hidden hg100 layui-form" id="Memberlist">

	<div class="feeldesk-form pd0 feelcrm-form">

		<div class="layui-tab">

			<ul class="layui-tab-title">

				<li class="tab-title-name"><?php echo L('USER_LIST');?></li>

				<li class="tab-title-btn">

					<a href="javascript:void(0);" id="memberDetailLay" class="layui-btn layui-btn-normal titleSubmit"><?php echo l('SUBMIT');?></a>

					<a href="javascript:closeLayerAll();" class="layui-btn layui-btn-normal titleCancel"><?php echo l('CANCEL');?></a>

					<div class="clear"></div>

				</li>

				<form1 action="" class="fr selectMemberForm" method="get">

					<div class="compact-search">

						<i class="iconfont icon-search"></i>

						<input type="text" name="selectMemberKeyword" value="" placeholder="<?php echo L('NAME1');?>/<?php echo L('CELL_PHONE');?>"/>

						<a href="javascript:" class="selectMemberBtn"><?php echo L('SEARCH');?></a>

					</div>

				</form1>

			</ul>

		</div>

	</div>

	<div class="feelcrm-list">

		<table class="layui-table" lay-skin="line">

			<thead>

				<tr>

					<th></th><th><?php echo L('NAME');?></th><th><?php echo L('EMAIL');?></th><th><?php echo L('MOBILE');?></th><th><?php echo L('SUBORDINATE_SECTOR');?></th><th><?php echo L('ROLE');?></th>

				</tr>

			</thead>

			<tbody id="member-detail">

				<?php if(empty($member)): ?><tr class="nodata center">

						<td colspan="11">

							<p><i class="iconfont icon-nothing fts20"></i></p>

							<p><?php echo L('NO_DATA');?></p>

						</td>

					</tr>

				<?php else: ?>

					<?php if(is_array($member)): $i = 0; $__LIST__ = $member;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>

							<td><input type="radio" value="<?php echo encrypt($vo['member_id'],'MEMBER');?>" name="member" lay-skin="primary" /></td>

							<td><?php echo ($vo["name"]); ?></td>

							<td><?php echo ($vo["email"]); ?></td>

							<td><?php echo ($vo["mobile"]); ?></td>

							<td><?php echo CrmgetMemberGroupName($groupList,$vo['group_id']);?></td>

							<td><?php echo ($roleList[$vo['role_id']]['role_name']); ?></td>

						</tr><?php endforeach; endif; else: echo "" ;endif; endif; ?>

			</tbody>

		</table>

		<div class="right-list-page clearfix"><div class="feeldesk-page"><?php echo ($memberPage); ?></div></div>

	</div>

</div>

<script>

	$('input[name="selectMemberKeyword"]').unbind('keyup').keyup(function (e)
	{
		e.stopPropagation();

		if (e.keyCode == 13)
		{
			searchSelectMemberList();

			return false;
		}
	});

	$('.selectMemberBtn').unbind('click').bind('click',function(){

		searchSelectMemberList();

		return false;
	})

	function searchSelectMemberList()
	{
		var keyword = $('input[name="selectMemberKeyword"]').val();

		$.ajax({
			url:"<?php echo U('AjaxRequest/getMemberList');?>",
			type:'get',
			data:{'sMemberKeyword':keyword},
			async: false,
			datatype:'json',
			success:function(data)
			{

				$('#member-detail').html(data.html);

				$('#Memberlist .feeldesk-page').html(data.page);

				layui.use('form', function() {

					var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

					form.render();

				});

				$('#Memberlist .feeldesk-page a').click(function()
				{
					pageclick(this);

					return false;
				})

			},
			error:function()
			{
				layer.msg("<?php echo L('FAILED_TO_ACQUIRE_USER');?>");
			}
		});
	}

</script>


		<script>

			$(function(){

				$('#Memberlist .feeldesk-page a').click(function(){

					pageclick(this,'/Opportunity/index');

					return false;
				})

			})

		</script><?php endif; ?>

	<div class="export-content hidden" id="export-content">

	<form action="" method="get" id="exportForm">

		<ul>

			<?php if(is_array($export_list)): $i = 0; $__LIST__ = $export_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li>

					<a href="javascript:"><?php echo ($v["name"]); ?></a>

					<input type="checkbox" name="exportList[]" value="<?php echo ($v["define"]); ?>" class="hidden" />

				</li><?php endforeach; endif; else: echo "" ;endif; ?>


			<div class="clear"></div>

			<li class="export-type">

				<a href="javascript:" class="select-this"><?php echo L('EXPORT_THIS_PAGE');?></a>

				<input type="radio" name="exporttype" value="thisdata" checked class="hidden" />

			</li>

			<li class="export-type">

				<a href="javascript:"><?php echo L('EXPORT_ALL');?></a>

				<input type="radio" name="exporttype" value="alldata" class="hidden" />

			</li>

			<li class="export-type">

				<a href="javascript:"><?php echo L('PAGINATED_EXPORT');?></a>

				<input type="radio" name="exporttype" value="pagedata" class="hidden" />

			</li>

			<span>

				<input type="number" name="startpage" class="export-page-input" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="" /> <?php echo L('PAGE');?> --

				<input type="number" name="endpage" class="export-page-input" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="" /> <?php echo L('PAGE');?>

				<input type="hidden" name="nowpage" value="<?php echo ($nowPage); ?>"  />

			</span>

			<div class="clear"></div>

			<div class="export_explain"><span>*</span> <?php echo L('EXPORT_REMARK');?></div>

		</ul>

	   <div class="export-content-footer mb20"><a href="javascript:" class="feelcrm-commbtn" id="toExport"><?php echo L('START_EXPORT');?></a></div>

	</form>

</div>


	
<div class="hidden hg100 layui-form" id="selectCustomerCon">

	<div class="feeldesk-form pd0 feelcrm-form ">

		<div class="layui-tab">

			<ul class="layui-tab-title">

				<li class="tab-title-name"><?php echo L('CUSTOMER_LIST');?></li>

				<li class="tab-title-btn">

					<a href="javascript:void(0);" class="layui-btn layui-btn-normal titleSubmit" id="selectCustomerSubmit"><?php echo l('SUBMIT');?></a>

					<a href="javascript:void(0);" class="layui-btn layui-btn-normal titleCancel" id="selectCustomerCancel"><?php echo l('CANCEL');?></a>

					<div class="clear"></div>

				</li>

				<form action="" class="fr selectCustomerForm" method="get">

					<input type="hidden" name='customer_auth' value="<?php echo ($customer_view_auth); ?>" />

					<input type="hidden" name='highKeyword[condition]' value="1" />

					<input type="hidden" name='highKeyword[define_form][importance]' />

					<input type="hidden" name='highKeyword[define_form][customer_grade]' />

					<div class="compact-search">

						<i class="iconfont icon-search"></i>

						<input type="text" name="selectCustomerKeyword" value="" placeholder=""/>

						<input type="text" class="hidden" name="" value="" placeholder=""/>

						<a href="javascript:" class="selectCustomerBtn"><?php echo L('SEARCH');?></a>

					</div>

				</form>

				<div class="clear"></div>

			</ul>

		</div>

		<div class="border_b">

			<div class="customer-list-filter select-fiter" data-type="customer_auth">

				<div class="customer-list-filter-tit"><?php echo L('VIEW_RANGE');?></div>

				<?php if(!empty($isCustomerOwnViewAuth)): ?><div class="customer-list-filter-option <?php if(($customer_view_auth) == "own"): ?>active<?php endif; ?>" data-value="own"><?php echo L('PERSONAL');?></div><?php endif; ?>

				<?php if(!empty($isCustomerGroupViewAuth)): ?><div class="customer-list-filter-option <?php if(($customer_view_auth) == "group"): ?>active<?php endif; ?>" data-value="group"><?php echo L('GROUP');?></div><?php endif; ?>

				<?php if(!empty($isCustomerAllViewAuth)): ?><div class="customer-list-filter-option <?php if(($customer_view_auth) == "all"): ?>active<?php endif; ?>" data-value="all"><?php echo L('WHOLE');?></div><?php endif; ?>

			</div>

			<?php if(is_array($customerFilterlist)): $i = 0; $__LIST__ = $customerFilterlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="customer-list-filter select-fiter" data-type="highKeyword[define_form][<?php echo ($vo["form_name"]); ?>]">

					<div class="customer-list-filter-tit"><?php echo ($vo["form_description"]); ?></div>

					<?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><div class="customer-list-filter-checkbox <?php if(in_array($v,explode(',',$highKeyword['define_form'][$vo['form_name']]))): ?>active<?php endif; ?>" data-value="<?php echo ($v); ?>"><span class="iconfont <?php if(in_array($v,explode(',',$highKeyword['define_form'][$vo['form_name']]))): ?>icon-square-selected<?php else: ?>icon-weixuanzhong<?php endif; ?>"></span><?php echo ($v); ?></div><?php endforeach; endif; else: echo "" ;endif; ?>

				</div><?php endforeach; endif; else: echo "" ;endif; ?>

		</div>

	</div>

	<div class="feelcrm-list">

		<table class="layui-table" lay-skin="line">

			<thead>

				<tr>

					<th></th><th><?php echo L('CUSTOMER_NUMBER');?></th><th><?php echo L('CLIENT_NAME');?></th><th><?php echo L('TEL');?></th><th><?php echo L('CREATE_TIME');?></th>

				</tr>

			</thead>

			<tbody id="selectCustomer-detail">

				<?php if(empty($selectCustomer)): ?><tr class="nodata center">

						<td colspan="11">

							<p><i class="iconfont icon-nothing fts20"></i></p>

							<p><?php echo L('NO_DATA');?></p>

						</td>

					</tr>

				<?php else: ?>

					<?php if(is_array($selectCustomer)): $i = 0; $__LIST__ = $selectCustomer;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>

							<td><input type="radio" value="<?php echo ($vo["customer_id"]); ?>" data-name="<?php echo ($vo["detail"]["name"]); ?>" name="selectCustomer" lay-skin="primary" /></td>

							<td><?php echo ($vo["customer_prefix"]); echo ($vo["customer_no"]); ?></td>

							<td><?php echo ($vo["detail"]["name"]); ?></td>

							<td><?php echo ($vo["detail"]["phone"]); ?></td>

							<td><?php echo (getDates($vo["createtime"])); ?></td>

						</tr><?php endforeach; endif; else: echo "" ;endif; endif; ?>

			</tbody>

		</table>

		<div class="right-list-page clearfix"><div class="feeldesk-page"><?php echo ($selectCustomerPage); ?></div></div>

	</div>

</div>

<script>

	var selectActionUrl = '/<?php echo (CONTROLLER_NAME); ?>/<?php echo (ACTION_NAME); ?>';

	var selectAction = '<?php echo (ACTION_NAME); ?>';

	$('#selectCustomer').click(function(){

		var wHeight = $(window).height();

		wHeight = wHeight - 180 + 'px';

		var selectCustomercon = layer.open({
			type: 1,
			title: false,
			scrollbar:false,
			area: ['80%',wHeight],
			closeBtn:0,
			content: $('#selectCustomerCon')
		});

		var custfilternum = $('.customer-list-filter').length;

		var custlistHeight = $('#selectCustomerCon').height();

		if(custfilternum > 0)
		{
			var custfilterHeight = 45 * custfilternum;

			var custlistH = custlistHeight - 65 - custfilterHeight + 20;

			if($('.list-header').is(':hidden'))
			{
				custlistH = custlistH + 60;
			}

			$('#selectCustomerCon .feelcrm-list').css('height',custlistH - 20 +'px');
		}

		$('#selectCustomerCancel').click(function()
		{
			layer.close(selectCustomercon);
		})

		$('#selectCustomerSubmit').click(function()
		{
			var customer_id = $('input[name="selectCustomer"]:checked').val();

			var customer_name = $('input[name="selectCustomer"]:checked').attr('data-name');

			$('#selectCustomerInput').val(customer_id);

			$('#selectCustomerInput').attr('title',customer_name);

			layui.use('form', function() {

				var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

				form.render('radio');

			});

			if(selectAction == 'create_follow')
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getContacter');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id},
					datatype:'json',
					success:function(data)
					{

						$('#ContacterList').html(data.html);

						layui.use('form', function() {

							var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

							form.render('select');

						});

						$('#ContacterList').parent().removeClass('hidden');
					},
					error:function()
					{

					}
				});
			}

			if(selectAction == 'create_contacter')
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getContacter');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id},
					datatype:'json',
					success:function(data)
					{

						$('#ContacterList').html(data.html);

						$("#ContacterList").select2();
					},
					error:function()
					{

					}
				});
			}

			if(selectActionUrl == '/Contract/create')
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getOpportunity');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id},
					datatype:'json',
					success:function(data)
					{
						$('#OpportunityList').html(data.html);

						$("#OpportunityList").select2();

						$("#OpportunityList").change(function ()
						{
							var opportunity_id = $(this).val();

							$('#chooseProList').html('');

							//选择商机后，更新合同金额及展示产品
							$.ajax({
								url:"<?php echo U('AjaxRequest/selectOpportunity');?>",
								type:'POST',
								async: false,
								data:{'opportunity_id':opportunity_id},
								datatype:'json',
								success:function(data)
								{
									$('#chooseProList').append(data.html);

									$.each($('input[name="product[]'),function(){

										var val = $(this).val();

										if($.inArray(val,data.product) != -1)
										{
											$(this).attr("checked","checked");

											layui.form.render();
										}

									});

									$(".proUnitPrice").bind("change",function(){
										countPrice(this);
									})

									$(".proContractNum").bind("change",function(){
										countPrice(this);
									})

									proKey = data.proKey;
								}
							});
						})
					}
				});
			}

			if($.inArray(selectActionUrl,['/Account/create','/Receipt/create','/Invoice/create','/Account/index','/Receipt/index','/Invoice/index']) != -1)
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getContract');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id,'type':'option'},
					datatype:'json',
					success:function(data)
					{
						$('#contractList').html(data.html);

						layui.use('form', function() {

							var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

							form.render('select');

						});
					}
				});

				if(selectActionUrl == '/Invoice/create')
				{
					$.ajax({
						url:"<?php echo U('AjaxRequest/getCustomerInvoiceInfo');?>",
						type:'POST',
						async: false,
						data:{'customer_id':customer_id},
						datatype:'json',
						success:function(data)
						{
							$('#InvoiceInfoList').html(data.html);

							layui.use('form', function() {

								var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

								form.render('select');

							});
						}
					});
				}
			}

			/*if(selectActionUrl == '/Order/create')
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getContract');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id},
					datatype:'json',
					success:function(data)
					{
						$('#selectContract span').html("<?php echo L('SELECT_ASSOCIATED_CONTRACT');?>");

						$('#contractList').hide();

						$('#contractList').html(data.html);

						$("#selectContract").unbind('click').on('click',function()
						{
							var checkbox = $(this);

							$(this).toggleClass('feeldesk-form-checked').next('.feeldesk-option-panel').slideToggle('fast');

							$(this).parents('.feeldesk-form-item').siblings().find('.feeldesk-input').removeClass('feeldesk-form-checked').next('.feeldesk-option-panel').slideUp('fast');

							$(".checkboxPanel").find('li').on('click',function()
							{
								var value = $(this).data('value');

								$(this).find('span.iconfont').toggleClass('icon-xuanze');

								$(this).find('span.iconfont').toggleClass('icon-xuanzhong');

								var oldValue = checkbox.find('span').text();

								var content = '';

								if($(this).find('span.iconfont').hasClass('icon-xuanzhong'))
								{
									$(this).find("input").prop('checked',true);

									content = addContent(oldValue,value);
								}
								else
								{
									$(this).find("input").prop('checked',false);

									content = removeContent(oldValue,value);
								}

								$(this).parent('.checkboxPanel').prev('.checkbox').find('span').text(content);
							});
						});


					},
					error:function()
					{

					}
				});
			}

			if(selectActionUrl == '/Contract/create')
			{
				$.ajax({
					url:"<?php echo U('AjaxRequest/getOrder');?>",
					type:'POST',
					async: false,
					data:{'customer_id':customer_id},
					datatype:'json',
					success:function(data)
					{
						$('#selectOrder span').html('请选择关联订单');

						$('#orderList').hide();

						$('#orderList').html(data.html);

						$("#selectOrder").unbind('click').on('click',function()
						{
							var checkbox = $(this);

							$(this).toggleClass('feeldesk-form-checked').next('.feeldesk-option-panel').slideToggle('fast');

							$(this).parents('.feeldesk-form-item').siblings().find('.feeldesk-input').removeClass('feeldesk-form-checked').next('.feeldesk-option-panel').slideUp('fast');

							$(".checkboxPanel").find('li').on('click',function()
							{
								var value = $(this).data('value');

								$(this).find('span.iconfont').toggleClass('icon-xuanze');

								$(this).find('span.iconfont').toggleClass('icon-xuanzhong');

								var oldValue = checkbox.find('span').text();

								var content = '';

								if($(this).find('span.iconfont').hasClass('icon-xuanzhong'))
								{
									$(this).find("input").prop('checked',true);

									content = addContent(oldValue,value);
								}
								else
								{
									$(this).find("input").prop('checked',false);

									content = removeContent(oldValue,value);
								}

								$(this).parent('.checkboxPanel').prev('.checkbox').find('span').text(content);
							});
						});


					},
					error:function()
					{

					}
				});
			}*/

			layer.close(selectCustomercon);

		})
	})

	$('.select-fiter .customer-list-filter-option').on('click',function ()
	{
		var type = $(this).parent().data('type');

		var value = $(this).data('value');

		$(this).addClass('active').siblings().removeClass('active');

		$("input[name='"+type+"']").val(value);

		searchCustomer();
	})

	$('.select-fiter .customer-list-filter-checkbox span').on('click',function ()
	{
		var type = $(this).parent().parent().data('type');

		//var value = $(this).parent().data('value');

		if($(this).hasClass('icon-square-selected'))
		{
			$(this).removeClass('icon-square-selected').addClass('icon-weixuanzhong');
			$(this).parent().removeClass('active');
		}
		else
		{
			$(this).removeClass('icon-weixuanzhong').addClass('icon-square-selected');
			$(this).parent().addClass('active');
		}

		var value = [];

		var check = $(this).parent().parent().find('.customer-list-filter-checkbox.active');

		check.each(function()
		{
			value.push($(this).attr('data-value'));
		});

		value = value.toString();

		if(!value) value = '';

		$("input[name='"+type+"']").val(value);

		searchCustomer();
	})

	function selectCustomerPage(obj,selectActionUrl)
	{
		var href = $(obj).attr('href');

		var ajaxhref = href.replace(selectActionUrl, '/AjaxRequest/getCustomerList');

		$.ajax({
				url:ajaxhref,
				type:'POST',
				async: false,
				datatype:'json',
				success:function(data)
				{

					$('#selectCustomer-detail').html(data.html);

					$('#selectCustomerCon .feeldesk-page').html(data.page);

					layui.use('form', function() {

						var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

						form.render();

					});

					$('#selectCustomerCon .feeldesk-page a').click(function()
					{
						selectCustomerPage(this);

						return false;
					})

				},
				error:function()
				{
				   layer.msg("<?php echo L('FAILED_TO_ACQUIRE_CUSTOMERS');?>");
				}
		 });
	}

	$('#selectCustomerCon .feeldesk-page a').click(function()
	{
		selectCustomerPage(this,selectActionUrl);

		return false;
	})

	$('input[name="selectCustomerKeyword"]').keyup(function (e)
	{
		if (e.keyCode == 13)
		{
			searchCustomer();
		}
	});

	$('.selectCustomerBtn').unbind('click').bind('click',function(){

		searchCustomer();
	})

	function searchCustomer()
	{
		var keyword = $('input[name="selectCustomerKeyword"]').val();

		var importance = $('input[name="highKeyword[define_form][importance]"]').val();

		var customer_grade = $('input[name="highKeyword[define_form][customer_grade]"]').val();

		var customer_auth = $('input[name="customer_auth"]').val();

		var highKeyword ={
			'define_form':{'importance':importance,'customer_grade':customer_grade}
		};

		$.ajax({
				url:"<?php echo U('AjaxRequest/getCustomerList');?>",
				type:'get',
				data:{'keyword':keyword,'highKeyword':highKeyword,'customer_auth':customer_auth},
				async: false,
				datatype:'json',
				success:function(data)
				{
					$('#selectCustomer-detail').html(data.html);

					$('#selectCustomerCon .feeldesk-page').html(data.page);

					layui.use('form', function() {

						var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

						form.render();

					});

					$('#selectCustomerCon .feeldesk-page a').click(function()
					{
						selectCustomerPage(this);

						return false;
					})

				},
				error:function()
				{
				   layer.msg("<?php echo L('FAILED_TO_ACQUIRE_CUSTOMERS');?>");
				}
		 });

		return false;
	}

</script>


	<script>

		var export_url = "/Opportunity/export";

		var export_action = "<?php echo (ACTION_NAME); ?>";

	</script>

	<script type="text/javascript">

		layui.use('upload', function()
		{
			var upload = layui.upload;

			upload.render(
			{
				elem:'#uploadFile',

				url: "<?php echo U('Upload/importExcel',['source'=>'opportunity']);?>",

				field:'excel',

				exts: 'xlsx|xls',

				accept:'file',

				before:function()
				{
					layer.msg("<?php echo L('IMPORT_LOADING');?>",{time:1000000,shift:0,offset:['100px']})
				},
				done: function(res)
				{
					if(res.error == 1)
					{
						layer.msg(res.msg,{icon:1,time:1000,shift:0,offset:['60px']},function()
						{
							window.location.href = res.url;
						});
					}
					else
					{
						layer.msg(res.msg,{icon:2,time:2000,offset:['60px']});
					}
				}
			})
		});

	</script>



    </div>

    </body>

</html>